package com.dousb.cloudlibrary.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dousb.cloudlibrary.model.dto.record.RecordQueryRequest;
import com.dousb.cloudlibrary.model.entity.Record;
import com.dousb.cloudlibrary.model.vo.RecordVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 借阅表服务
 */
public interface RecordService extends IService<Record> {

    /**
     * 校验数据
     *
     * @param record
     * @param add    对创建的数据进行校验
     */
    void validRecord(Record record, boolean add);

    /**
     * 获取查询条件
     *
     * @param recordQueryRequest
     * @return
     */
    QueryWrapper<Record> getQueryWrapper(RecordQueryRequest recordQueryRequest);

    /**
     * 获取借阅表封装
     *
     * @param record
     * @param request
     * @return
     */
    RecordVO getRecordVO(Record record, HttpServletRequest request);

    /**
     * 分页获取借阅表封装
     *
     * @param recordPage
     * @param request
     * @return
     */
    Page<RecordVO> getRecordVOPage(Page<Record> recordPage, HttpServletRequest request);
}
